package com.hdu.other.dp.gupiao;

public class lc122 {
    class Solution {
        public int maxProfit(int[] prices) {
            int ans = 0;
            for (int i = 1;  i < prices.length; i++) {
                ans += Math.max(0, prices[i] - prices[i - 1]);
            }
            return ans;
        }
    }
}
